<template>
    <div id="app">
        <el-form  :model="section" label-width="80px">
            <el-form-item label="支部名称">
                <el-input v-model="section.name" placeholder="请输入支部名称"></el-input>
            </el-form-item>

            <el-form-item label="支部介绍">
                <el-input v-model="section.intro" placeholder="请输入支部介绍"></el-input>
            </el-form-item>

            <el-form-item label="支部背景">
                <el-input v-model="section.backg" placeholder="请输入支部背景"></el-input>
            </el-form-item>

            <div class="block">
                <el-form-item label="创建日期">
                    <el-date-picker
                            v-model="section.createTime"
                            :disabled="true"
                            align="right"
                            type="date"
                            placeholder="默认为当前时间"
                            :picker-options="pickerOptions">
                    </el-date-picker>
                </el-form-item>
            </div>
        </el-form>
        <div style="margin: 10px 10px 10px 10px">
            <el-button type="primary" @click="addDept">添加部门</el-button>
        </div>
    </div>
</template>

<script>
    export default {
        name: "addBranch",
        data(){
           return{
               section:{},
               timer: null,
           }
        },
        methods:{
            //添加部门
            addDept(){
                this.$http.post("/system/branch/addBranch",this.section).then(resp=>{
                    if(resp.data.code == 200){
                        this.$message.success("添加成功");
                        this.section={};
                        clearTimeout(this.timer); //清除延迟执行

                        this.timer = setTimeout(()=>{  //设置延迟执行
                            this.update();
                        },1000);
                    }else {
                        this.$message.success("添加失败")
                    }
                })
            },

            //跳转
            // update(){
            //     window.parent.iframeFunction('/selectIdDept.html','查看部门');
            // },
        }
    }
</script>

<style scoped>


    html,body,#app{
        margin: 0px;
        padding: 0px;
    }
    #app{
        width: 500px;
        padding-left: 400px;
        /*margin-left: 200px;*/
    }
    .avatar-uploader .el-upload {
        border: 1px dashed #d9d9d9;
        border-radius: 6px;
        cursor: pointer;
        position: relative;
        overflow: hidden;
    }
    .avatar-uploader .el-upload:hover {
        border-color: #409EFF;
    }
    .avatar-uploader-icon {
        font-size: 28px;
        color: #8c939d;
        width: 178px;
        height: 178px;
        line-height: 178px;
        text-align: center;
    }
    .avatar {
        width: 178px;
        height: 178px;
        display: block;
    }
    .el-header, .el-footer {
        background-color: #B3C0D1;
        color: #333;
        text-align: center;
        line-height: 60px;
    }

    .el-aside {
        background-color: #D3DCE6;
        color: #333;
        text-align: center;
        line-height: 500px;
    }

    .el-main {
        background-color: #E9EEF3;
        color: #333;
        text-align: center;
    }

    body > .el-container {
        margin-bottom: 40px;
    }
    .el-container:nth-child(5) .el-aside,
    .el-container:nth-child(6) .el-aside {
        line-height: 260px;
    }

    .el-container:nth-child(7) .el-aside {
        line-height: 320px;
    }
</style>